﻿using EPiServer.Core;
using EPiServer.SpecializedProperties;
using log4net;

namespace TemplateFoundation.Plugins
{
    /// <summary>
    /// Maps EPiServer property types to Template Foundation property controls
    /// </summary>
    public class PropertyControlsSetup : EPiServer.PlugIn.PlugInAttribute
    {
        private static readonly ILog _logger = LogManager.GetLogger(typeof (PropertyControlsSetup));

        /// <summary>
        /// Map EPiServer properties to ETF property controls
        /// </summary>
        public static void Start()
        {
            _logger.Debug("[ETF] Remapping property controls for EPiServer string property types");

            PropertyControlClassFactory.Instance.RegisterClass(typeof(PropertyString), typeof(WebControls.PropertyControls.PropertyStringControl));
            PropertyControlClassFactory.Instance.RegisterClass(typeof(PropertyLongString), typeof(WebControls.PropertyControls.PropertyLongStringControl));
            PropertyControlClassFactory.Instance.RegisterClass(typeof(PropertyXhtmlString), typeof(WebControls.PropertyControls.PropertyXhtmlStringControl));
        }
    } 
}
